﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;

public class EPosta
{
    public EPosta()
    {

    }

    #region EPostaGonder

    //public static bool EPostaGonder(string Kime, string Baslık, string Icerik)
    //{
    //    try
    //    {

    //        string EPostaAdresi = "site@skaladeri.com.tr";
    //        string MailHost = "127.0.0.1";

    //        MailMessage EPosta = new MailMessage(EPostaAdresi, Kime);

    //        EPosta.Sender = new MailAddress(EPostaAdresi, "Skala");
    //        EPosta.Subject = Baslık;
    //        EPosta.IsBodyHtml = true;
    //        EPosta.Body = Icerik;
    //        EPosta.IsBodyHtml = true;
    //        EPosta.Priority = MailPriority.Normal;

    //        SmtpClient smtp = new SmtpClient(MailHost, 587);
    //        smtp.Credentials = new NetworkCredential("site@skaladeri.com.tr", "sT14m5cmt");

    //        smtp.UseDefaultCredentials = true;
    //        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    //        smtp.EnableSsl = false;


    //        smtp.Send(EPosta);
    //        return true;
    //    }
    //    catch (Exception ex)
    //    {
    //        return false;
    //    }
    //}

    public static bool EPostaGonder(string Kime, string Baslık, string Icerik)
    {
        try
        {
            string EPostaAdresi = "kadirakis@gmail.com";
            string MailHost = "smtp.gmail.com";

            MailMessage EPosta = new MailMessage(EPostaAdresi, Kime);

            EPosta.Sender = new MailAddress(EPostaAdresi, "Skala");
            EPosta.Subject = Baslık;
            EPosta.IsBodyHtml = true;
            EPosta.Body = Icerik;
            EPosta.IsBodyHtml = true;
            EPosta.Priority = MailPriority.Normal;

            SmtpClient smtp = new SmtpClient(MailHost, 587);
            smtp.Credentials = new NetworkCredential("kadirakis@gmail.com", "ferdiko27");

            //smtp.UseDefaultCredentials = true;
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.EnableSsl = true;


            smtp.Send(EPosta);
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }
    }
    #endregion
}